package com.yaojiaxun.logisticsPlatformSystem.service;

import com.yaojiaxun.logisticsPlatformSystem.entity.PlatformInfo;
import com.yaojiaxun.logisticsPlatformSystem.mapper.PlatformInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.Instant;

/**
 * @Auther: yjx_j
 * @Date: 2019/2/19 13:36
 * @Description:
 */
@Service
public class PlatformService {
    @Autowired
    private PlatformInfoMapper platformInfoMapper;

    public PlatformInfo findPlatformInfo(){
        return platformInfoMapper.selectPlatformInfo();
    }

    public boolean insertPlatform(PlatformInfo platformInfo){
        platformInfo.setCreateTime(Instant.now().toEpochMilli());
        platformInfo.setUpdateTime(Instant.now().toEpochMilli());
        return platformInfoMapper.insertPaltformInfo(platformInfo)>0;
    }

    public boolean updatePlatformInfo(PlatformInfo platformInfo){
        platformInfo.setCreateTime(Instant.now().toEpochMilli());
        platformInfo.setUpdateTime(Instant.now().toEpochMilli());
        return platformInfoMapper.updatePlatInfo(platformInfo)>0;
    }
}
